﻿<Window x:Class="Notoric.Gui.Windows.ChangeKeySignatureDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:rb="clr-namespace:Fluent;assembly=Fluent"
        xmlns:vme="clr-namespace:Notoric.ViewModel.Elements;assembly=ViewModel"
        xmlns:cvr="clr-namespace:Notoric.Gui.Converters"
        Title="Change Key Signature" Height="198" Width="400"
        Background="#FFF0F0F0" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
        DataContextChanged="Window_DataContextChanged">
    <Window.Resources>
        <cvr:VisibilityConverter x:Key="VisibilityConverter"/>
    </Window.Resources>
    <StackPanel x:Name="LayoutRoot">
        <Grid x:Name="ContentRoot" Background="White" Height="110" Margin="7 7 7 0">
            <Grid.RowDefinitions>
                <RowDefinition Height="64"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="240"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            
            <Grid x:Name="Key" Grid.Column="0" Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="30"/>
                </Grid.ColumnDefinitions>
                
                <Label Content="Key" VerticalAlignment="Center"/>
                
                <ComboBox x:Name="PART_Key" Background="White" Grid.Column="1" SelectedIndex="0">
                    <ComboBoxItem Tag="0,0,0,0,0,0,0">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/c_major.png" VerticalAlignment="Center"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="C Major"/>
                                <TextBlock Text="a minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="0,0,0,0.5,0,0,0" Visibility="{Binding ElementName=PART_Sharps, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/g_major.png"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="G Major"/>
                                <TextBlock Text="e minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="0.5,0,0,0.5,0,0,0" Visibility="{Binding ElementName=PART_Sharps, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/d_major.png"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="D Major"/>
                                <TextBlock Text="b minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="0.5,0,0,0.5,0.5,0,0"  Visibility="{Binding ElementName=PART_Sharps, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/a_major.png"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="A Major"/>
                                <TextBlock Text="f# minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="0.5,0.5,0,0.5,0.5,0,0"  Visibility="{Binding ElementName=PART_Sharps, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/e_major.png"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="E Major"/>
                                <TextBlock Text="c# minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="0.5,0.5,0.5,0.5,0.5,0,0" Visibility="{Binding ElementName=PART_Sharps, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/h_major.png"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="B Major"/>
                                <TextBlock Text="g# minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="0.5,0.5,0.5,0.5,0.5,0.5,0" Visibility="{Binding ElementName=PART_Sharps, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/fis_majo.png"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="F# Major"/>
                                <TextBlock Text="d# minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="0.5,0.5,0.5,0.5,0.5,0.5,0.5" Visibility="{Binding ElementName=PART_Sharps, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/cis_majo.png"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="C# Major"/>
                                <TextBlock Text="a# minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>

                    <ComboBoxItem Tag="0,0,0,0,0,0,-0.5" Visibility="{Binding ElementName=PART_Flats, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/f_major.png" VerticalAlignment="Center"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="F Major"/>
                                <TextBlock Text="d minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="0,0,-0.5,0,0,0,-0.5" Visibility="{Binding ElementName=PART_Flats, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/b_major.png" VerticalAlignment="Center"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="B Major"/>
                                <TextBlock Text="g minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="0,0,-0.5,0,0,-0.5,-0.5" Visibility="{Binding ElementName=PART_Flats, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/es_major.png" VerticalAlignment="Center"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="Eb Major"/>
                                <TextBlock Text="c minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="0,-0.5,-0.5,0,0,-0.5,-0.5" Visibility="{Binding ElementName=PART_Flats, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/as_major.png" VerticalAlignment="Center"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="Ab Major"/>
                                <TextBlock Text="f minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="0,-0.5,-0.5,0,-0.5,-0.5,-0.5" Visibility="{Binding ElementName=PART_Flats, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/des_majo.png" VerticalAlignment="Center"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="Db Major"/>
                                <TextBlock Text="b minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="-0.5,-0.5,-0.5,0,-0.5,-0.5,-0.5" Visibility="{Binding ElementName=PART_Flats, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/ges_majo.png" VerticalAlignment="Center"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="Gb Major"/>
                                <TextBlock Text="eb minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                    <ComboBoxItem Tag="-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5" Visibility="{Binding ElementName=PART_Flats, Path=IsChecked, Converter={StaticResource VisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Windows/ces_majo.png" VerticalAlignment="Center"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="Cb Major"/>
                                <TextBlock Text="ab minor"/>
                            </StackPanel>
                        </StackPanel>
                    </ComboBoxItem>
                </ComboBox>
                
                <StackPanel Orientation="Vertical" Grid.Column="2">
                    <RadioButton x:Name="PART_Sharps" FontFamily="MusicalSymbols" FontSize="18" Content="#" IsChecked="True" GroupName="KeyType"
                                 Margin="0 -12 0 0" Checked="PART_SharpsFlats_Checked"/>
                    <RadioButton x:Name="PART_Flats" FontFamily="MusicalSymbols" FontSize="18" Content="b" GroupName="KeyType"
                                 Margin="0 -12 0 0" Checked="PART_SharpsFlats_Checked"/>
                </StackPanel>
            </Grid>
            
            <Grid x:Name="Measures" Grid.Column="0" Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="128"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                
                <rb:Spinner x:Name="PART_From" Text="From Measure" Format="0" Minimum="1" Maximum="{Binding MeasuresCount, Mode=OneWay}" Value="1"/>
                <rb:Spinner x:Name="PART_To" Text="To Measure" Format="0" Grid.Column="1" Minimum="{Binding ElementName=PART_From, Path=Value, Mode=OneWay}" 
                            Maximum="{Binding MeasuresCount, Mode=OneWay}" Value="{Binding MeasuresCount, Mode=OneTime}"/>
            </Grid>
            
            <ListBox x:Name="PART_SelectedParts" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" ItemsSource="{Binding Parts, Mode=OneWay}" Margin="7 0 0 0">
                <ListBox.ItemTemplate>
                    <DataTemplate DataType="{x:Type vme:PartDescriptor}">
                        <StackPanel Orientation="Horizontal">
                            <CheckBox IsChecked="True" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" />
                            <TextBlock Text="{Binding Name, Mode=OneWay}"/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 10 7 0">
            <Button x:Name="PART_OK" Width="60" Content="OK" IsDefault="True" Click="PART_OK_Click"/>
            <Button x:Name="PART_Cancel" Width="60" Margin="6 0 0 0" Content="Cancel" IsCancel="True" Click="PART_Cancel_Click"/>
        </StackPanel>
    </StackPanel>
</Window>
